{% extends "base.html" %}
{% load i18n %}
{% block title%}{% trans "luca_customer_list" %}{% endblock%}
{% block breadcrumbs%}<li>{% trans "luca_customer_list" %}</li>{% endblock%}

 
{% block content %}

      {% if messages %}
	        {% for message in messages %}
	       		<div class="alert alert-success">
	        	 <a href="#" class="close" data-dismiss="alert">&times;</a>
	       			{{ message }}
	   			</div>
	        {% endfor %}  
	  {% endif %}

<div class="box-inner">
                <div class="box-header well" data-original-title="">
                    <h2>{% trans "luca_customer_list" %} ({{customers_list.paginator.count}})</h2>

                  <div class="box-icon">
                        <a href="/customer/new" class="btn btn-bew btn-round btn-default"><i class="glyphicon glyphicon-plus"></i></a>
                    </div>
                </div>
                <div class="box-content">
                    <table class="table table-bordered table-striped table-condensed">
                        <thead>
                        <tr>
                            <th>{% trans "luca_customer_name" %}</th>
                            <th>{% trans "luca_customer_telephone" %}</th>
                            <th class="hidden-xs">{% trans "luca_customer_location" %}</th>
                            <th class="hidden-xs">{% trans "luca_customer_group" %}</th>
                            <th class="hidden-xs">{% trans "created_at" %}</th>
                            <th class="hidden-xs">{% trans "updated_at" %}</th>
                            <th>{% trans "status" %}</th>
                        </tr>
                        </thead>
                        <tbody>
                  
                        {% if customers_list %}
						  
						    {% for customer in customers_list %}
						 <tr>
                            <td><a href="/customer/edit/{{customer.id}}">{{customer.name}}</a></td>
                            <td class="center">{{ customer.telephone }}</td>
                            <td class="center hidden-xs">{{ customer.location}}</td>
                            <td class="center hidden-xs">{{ customer.group}}</td>
                            <td class="center hidden-xs">{{ customer.created_at|date:"SHORT_DATE_FORMAT" }}</td>
                            <td class="center hidden-xs">{{ customer.updated_at|date:"SHORT_DATE_FORMAT" }}</td>
                            <td class="center">
                              
							 {% if customer.active == 1 %}
							    <span class="label-success label label-default">
							    	{% trans "active" %}
							    </span>
							 {% else %}
							    <span class="label label-default">
							    	{% trans "inactive" %}
							    </span>
							 {% endif %}  
							
                            </td>
                        </tr>
						    {% endfor %}
						  
						
						{% endif %}
						
						
                      
                        </tbody>
                    </table>

<div class="col-md-12 center-block {% if customers_list.paginator.num_pages == 1 %}hide{% endif %}">
			<div class="dataTables_paginate paging_bootstrap pagination">
				<ul class="pagination">
					<li class="prev {% if not customers_list.has_previous %}disabled{% endif %}">
						 <a href="?page={% if customers_list.has_previous %}{{ customers_list.previous_page_number }}{% endif %}">← Previous</a>
					</li>
					
					 {% for page in customers_list.paginator.page_range  %}
					<li class="{% if customers_list.number == page %}active{% endif %}">
						<a href="?page={{page}}">{{page}}</a>
					</li>
					
					 {% endfor %}
					<li class="next {% if not customers_list.has_next %}disabled{% endif %}" >
						 <a href="?page={% if customers_list.has_next %}{{ customers_list.next_page_number }}{% endif %}">Next → </a>
					</li>
				</ul>
			</div>
		</div>
                </div>
            </div>

{% endblock %}
